package collection;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;

/**
 * 增强型for循环
 */
public class NewForDemo {
    public static void main(String[] args) {
        String[] arr={"a","b","c","d","e"};
        for (int i = 0; i < arr.length; i++){
            String s=arr[i];
            System.out.println(s);
        }

        for (String s:arr){
            System.out.println(s);
        }
        Collection<String> c=new ArrayList();
        c.add("一");
        c.add("123");
        c.add("二");
        c.add("三");
        for(String s:c){
            System.out.println(s);
        }
        Iterator<String> it=c.iterator();
        while (it.hasNext()){
            String s=it.next();
            System.out.println(s);
        }
    }
}
